<?php
$db = new CPDO();
$id = _g('i');
$codes = array();
if($id){
	$sql = "select * from `cc_code` where `id` = " . $id;
	$codes = $db->get($sql);
}
$sql = 'select * from `cc_cate`';
$cates = $db->find($sql);
?>
<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>ALIBABA 国际搜索 李春城 后台管理系统</title>
	<link rel="stylesheet" type="text/css" href="<?=BASEWWW?>/css/base.css" media="all">
</head>
<body>
<div id="header"></div>


		<form enctype="multipart/form-data" method="post" action="?a=add&i=<?=$id?>">
			<div class="con">
				<h2 class="gray">必选</h2>
				<h1>类目</h1>
				<select name="cate">
					<?foreach($cates as $cate):?>
						<option value="<?=$cate->cate_name?>" <?php echo isset($cates->cate) ? 'selected' : '';?>><?=$cate->cate_name?></option>
					<?endforeach?>
				</select>
				<h1 class="error"></h1>
			</div>
			<hr>

			<div class="con">
				<h1>标题</h1>
				<input type="text" value="<?php echo isset($codes->title) ? $codes->title : '';?>" class="text border" id="title" name="title">
				<h1 class="error"></h1>
			</div>
			<hr>
			<div class="con">
				<h1>简短描述</h1>
				<textarea name="desc" style="width:50%"><?php echo isset($codes->desc) ? htmlspecialchars_decode($codes->desc) : '';?></textarea>
				<h1 class="error"></h1>
			</div>
			<hr>

			<div class="con">
				<h1>内容</h1>
				<textarea id="elm1" name="content" rows="15" cols="80" style="width: 80%"><?php echo isset($codes->content) ? htmlspecialchars_decode($codes->content) : '';?></textarea>
				<h1 class="error"></h1>
			</div>
			<hr>
			
			<div class="con">
				<input type="submit" name="form" id="submit" value="提交">
				<button id="cancel">取消</button>
			</div>
		</form>


	<div class="clearfix" id="footer" style="position:static;width:100%;">
		<div class="f-l"></div>
		<p>
			<a href="http://www.newzan.com/nz/about">关于牛赞</a> | 
			<a target="_blank" href="http://ued.newzan.com/feedback/add">意见反馈</a> | 
			<a href="http://www.newzan.com/nz/disclaimer">免责申明</a> | 
			<a href="http://www.newzan.com/nz/help">新手入门</a> | 
			<a target="_blank" href="http://blog.newzan.com">牛赞博客</a> |

		</p>
		<p>Copyright &copy; 2011 牛赞网</p>
	</div>

</body>
</html>
